package com.binance.notification.api;

import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.binance.master.configs.FeignConfig;
import com.binance.master.constant.Constant;
import com.binance.master.models.APIRequest;
import com.binance.master.models.APIResponse;
import com.binance.notification.api.push.notification.AndroidPayload;
import com.binance.notification.api.push.notification.AppPayload;
import com.binance.notification.api.push.notification.IosPayload;
import com.binance.notification.api.push.notification.MultipleNotificationPacket;
import com.binance.notification.api.push.notification.PcPayload;
import com.binance.notification.api.push.notification.SingleNotificationPacket;
import com.binance.notification.api.push.notification.WebPayload;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@FeignClient(name = Constant.NOTIFICATION_WEB_SERVICE, configuration = FeignConfig.class)
@Api(value = "对接后台“推送管理”的推送服务", tags = "对接后台“推送管理”的推送服务：该服务提供了进行推送的相关接口")
public interface PushApi {

    @ApiOperation(value = "推送特定平台自定义消息到客户端。可以一次性推送各个平台的自定义消息，可以参考其他几个接口说明。")
    @PostMapping("/jpush/notification/{async}")
    public APIResponse<String> pushNotification(@RequestBody APIRequest<List<MultipleNotificationPacket>> request,
            @PathVariable boolean async);

    @ApiOperation(value = "推送自定义消息到App端，即android和ios。如果是异步，则返回值为null；如果是同步，成功返回值为null，否则返回字符串类型异常信息。")
    @PostMapping("/jpush/app/notification/{async}")
    public APIResponse<String> pushAppNotification(
            @RequestBody APIRequest<SingleNotificationPacket<AppPayload>> request, @PathVariable boolean async);

    @ApiOperation(value = "推送自定义消息到android客户端。如果是异步，则返回值为null；如果是同步，则成功的将数据发送到极光服务器，则返回值为null，否则返回值是json格式错误信息。")
    @PostMapping("/jpush/android/notification/{async}")
    public APIResponse<String> pushAndroidNotification(
            @RequestBody APIRequest<SingleNotificationPacket<AndroidPayload>> request, @PathVariable boolean async);

    @ApiOperation(value = "推送自定义消息到ios客户端。如果是异步，则返回值为null；如果是同步，则成功的将数据发送到极光服务器，则返回值为null，否则返回值是json格式错误信息。")
    @PostMapping("/jpush/ios/notification/{async}")
    public APIResponse<String> pushIosNotification(
            @RequestBody APIRequest<SingleNotificationPacket<IosPayload>> request, @PathVariable boolean async);

    @ApiOperation(value = "推送自定义消息到pc客户端。如果是异步，则返回值为null；如果是同步，则成功的将数据发送到极光服务器，则返回值为null，否则返回值是json格式错误信息。")
    @PostMapping("/jpush/pc/notification/{async}")
    public APIResponse<String> pushPcNotification(@RequestBody APIRequest<SingleNotificationPacket<PcPayload>> request,
            @PathVariable boolean async);

    @ApiOperation(value = "推送单自定义消息到web客户端。如果是异步，则返回值为null；如果是同步，则成功的将数据发送到极光服务器，则返回值为null，否则返回值是json格式错误信息。")
    @PostMapping("/jpush/web/notification/{async}")
    public APIResponse<String> pushWebNotification(
            @RequestBody APIRequest<SingleNotificationPacket<WebPayload>> request, @PathVariable boolean async);

}
